#ifndef __VIEW_H__
#define __VIEW_H__

#include "Player.h"
#include "../Connector/Connector.h"
#include "../Connector/NetworkConnector.h"
#include "../Connector/ServerConnector.h"
#include "../Model/GameModel.h"
#include "../Settings/Settings.h"
#include <ncurses.h>
#include <vector>
typedef enum
{
  LOCAL,
  NETWORK
} GAME_TYPE;

typedef enum
{
  CLIENT,
  SERVER
} USER_TYPE;

class View
{
private:
  static const int MAX_PLAYER_SINGLE_MACHINE;
  std::vector<Player*> players_;

  GameModel *model_;
  Connector *connector_;
  NetworkConnector *client;
  ServerConnector *server;
  Settings &settings_;

  std::vector<std::string> cardFileNames_;

  GAME_TYPE gameType;
  USER_TYPE userType;  

  //number of players
  int playersNumber_;

  int duelWinner_;

  //draws current position
  void showCurrentPos() const;
  void printMovePlace(int y, int x) const;
  void printPlayersList() const;
  void printDuelMessage(int y) const;
  void getPlayersNames(Connector *connector);
 

  void connectPlayers();
  void gameCycle();
  void networkGameCycle();

  //prints some message in the center of the screen
  void printCenter(const std::string &message) const;

  //prints some message at the left top of the screen
  void printTop(const std::string &message) const;

  //prints card at (y,x)
  void printCard(int y, int x, int id, int color) const;

  void prepareColors() const;
  void startSettings();
  
public:
  View();
  View(Connector &connector);
  View(GameModel &model);
  ~View();
  int addPlayer(Player *player);

  //set cards filenames
  void setCardFileNames();

  int setConnector(Connector &connector);

  void start();
};
#endif
